import 'package:wardrobe_demo/bean/TwoLevelCategory.dart';

import '../base/model_interface/AbModelInterface.dart';
import '../bean/FirstLevelCategory.dart';
import '../db/DatabaseHelper.dart';

class MainPageViewModel {
  AbModelInterface data = DatabaseHelper();
  List<FirstLevelCategory> firList = [];
  List<TwoLevelCategory> twoList = [];


  Future<void> getALLOneCategory() async {
    return await data
        .getALLOneCategory()
        .then((value) => {firList.clear(), firList.addAll(value)});
  }

  Future<FirstLevelCategory> insertOneCategory(
      FirstLevelCategory firstLevenlCategory) {
    return data.insertOneCategory(firstLevenlCategory);
  }

  Future<void> getALLTwoCategory(int id) async{
    return await data
        .getALLTwoCategory(id)
        .then((value) => {twoList.clear(), twoList.addAll(value)});
  }

  Future<TwoLevelCategory> insertTwoCategory(
      TwoLevelCategory twoLevelCategory) {
    return data.insertTwoCategory(twoLevelCategory);
  }
}
//柜子信息

//一级列表
